﻿using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using AnyOffice.Components;
using AnyOffice.DAL;
using log4net;
using System.Reflection;
namespace AnyOffice.general.mytable
{
    public partial class dragconfig : BasePage
    {
        private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string str = (Request.QueryString["mytable"] != null) ? Request.QueryString["mytable"].ToString() : "";
                string mytableLeft = string.Empty;
                string mytableRight = string.Empty;
                if (str != string.Empty)
                {
                    if (str.IndexOf(":") == -1)
                    {
                        mytableRight = str;
                        if (mytableRight.EndsWith(","))
                        {
                            mytableRight = mytableRight.Substring(0, mytableRight.Length - 1);
                        }
                    }
                    else
                    {
                        mytableLeft = str.Substring(0, str.IndexOf(":"));
                        mytableRight = str.Substring(str.IndexOf(":") + 1);
                        if (mytableLeft.EndsWith(","))
                        {
                            mytableLeft = mytableLeft.Substring(0, mytableLeft.Length - 1);
                        }
                        if (mytableRight.EndsWith(","))
                        {
                            mytableRight = mytableRight.Substring(0, mytableRight.Length - 1);
                        }
                    }
                }
                new MyTableDao().SetMytable(base.Conn, base.User.Identity.Name, mytableLeft, mytableRight);
                UserCache.Update(base.User.Identity.Name);
            }
            catch (Exception exception)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("", exception);
                }
            }
        }

    }
}
